package com.wushi.smartorm;

import java.util.*;

/**
 * 读取Mapper properties
 * @program: smartorm
 * @description:
 * @author: Grant Wu
 * @create: 2020-05-18 23:08
 **/

public class OrmPropertiesReader {
    private static Properties properties=new Properties();
    static{
        init();
    }

    /**
     * 加载mapper.properteis
     */
    private static void init() {
        //ResourceBundle主要不要传property的扩展名
        ResourceBundle bundle = ResourceBundle.getBundle("WxNewsMapper");
        Set<String> keys = bundle.keySet();
        keys.forEach(key->{
//            SmartMapperStatement smartMapperStatement = new SmartMapperStatement();
            String sql = bundle.getString(key);
            properties.setProperty(key,sql);
        });

    }

    public static String getProperty(String key) {
        return properties.getProperty(key);
    }
}
